#include "socket_class.hpp"
#include "acceptor.hpp"
#include "network.hpp"
#include "tcp_link.hpp"
#include "io.hpp"
#include <iostream>
using std::cout;
using std::endl;



void test()
{

    rocket::acceptor server(10086,"127.0.0.1");
    server.start();
    cout<<"listening"<<endl;


    rocket::tcp_link link1( server.accept());
    cout<<"someone linked"<<endl;

    rocket::packet data;
    int ret=link1.read_packet(data);

    cout<<"receive :"<<ret<<":"<<endl;
    data.print();
    rocket::tlv tlv(data.get_type(),data.get_length(),data.get_data().c_str()); 
    link1.send_tlv(tlv);
    cout<<"send_tlv :";
    tlv.print();
}



void send_tlv()
{

}





int main()
{
    test();
    return 0;
}

